DicomObjects.NET.V8
In This Topic
    The Codec Model
    In This Topic

    From version 5.6.3.x onwards DicomObjects, including this version, has used a new model for Codec interfacing.  This is only used by those implementing their own custom codecs, and so does not affect the majority of customers, but for the benefit of those wishing to write/interface their own codecs, it is documented here.

    The main difference is that a Codec "factory" is now created and used for each transfer syntax, allowing an instance of an appropriate Codec object (supporting ICompressor or IDecompressor) to be created and used when necessary. This object is held alongside the associated pixel data, and allows "state" to be maintained between calls, which is important for progressive decompression.

    To use this interface:

    1. Implement a class derived from CodecFactory Class.  This must:
      1. Return a list of strings (DICOM UIDs or file extensions) when the TransferSyntaxes method is called.
      2. Return as suitable Codec (as below) when its Compressor, Decompressor, Importer or Exporter methods are called.  Only those methods for which a non-empty set of strings is returned from TransferSyntaxes need to function - the other may return NotImplemented exceptions.
    2. Implement suitable classes providing ICompressorIDecompressorIImporter, or IExporter interfaces to be returned from the above
    3. Call RegisterCodec Method in a startup method to register the factory class.

    The addition of progressive decoding has added some complexity to the IDecompressor interface, but this has been avoided for most users by addition of the SimpleCodec Class, which includes implementations of most of the members of both ICompressor and IDecompressor, leaving only the unavoidable Compress and Decompress methods.  It is still necessary to implement and register an associated CodecFactory to reference the new Codec, which should return and instance of the SimpleCodec derived class for one or both of the Compressor and Decompressor methods.